﻿using System.Windows;
using System.Windows.Controls;

namespace JY.Wpf.Controls.Controls
{
    /// <summary>
    /// 进度条控件
    /// </summary>
    public class JYScrollViewer : ScrollViewer
    {
        #region Private属性

        #endregion

        #region 依赖属性定义

        #endregion

        #region 依赖属性set get

        public double VerticalOffsetEx
        {
            get { return (double)this.GetValue(JYScrollViewer.VerticalOffsetExProperty); }
            set { this.SetValue(JYScrollViewer.VerticalOffsetExProperty, value); }
        }
        
        public static readonly DependencyProperty VerticalOffsetExProperty =
            DependencyProperty.Register("VerticalOffsetEx", typeof(double), typeof(JYScrollViewer), new PropertyMetadata(0d, JYScrollViewer.VerticalOffsetExChangedCallback));

        private static void VerticalOffsetExChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            JYScrollViewer scrollViewer = d as JYScrollViewer;
            scrollViewer?.ScrollToVerticalOffset((double)e.NewValue);
        }

        #endregion

        #region Constructors
        static JYScrollViewer()
        {
            FrameworkElement.DefaultStyleKeyProperty.OverrideMetadata(typeof(JYScrollViewer), new FrameworkPropertyMetadata(typeof(JYScrollViewer)));
            
        }

        public JYScrollViewer()
        {
            this.CanContentScroll = true;
        }
        #endregion

        #region Override方法
        
        #endregion

        #region Private方法
        #endregion
    }
}
